import React, { useRef, useEffect } from 'react';

const QRCode=require("qrcode");

export interface QRCodeProps {
  value?: string;
}

const ChildQRcode: React.FC<QRCodeProps> = ({ value }) => {
  const ref = useRef<HTMLCanvasElement>(null);

  useEffect(() => {
    if (value) QRCode.toCanvas(ref.current, value);
  }, [value]);

  return <canvas ref={ref} className='canvas-ss'></canvas>;
};

export default ChildQRcode;